﻿using System;
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.UI;

namespace Valve.VR.InteractionSystem
{
	// Token: 0x0200062E RID: 1582
	[RequireComponent(typeof(Interactable))]
	public class UIElement : MonoBehaviour
	{
		// Token: 0x060027FD RID: 10237 RVA: 0x000E8AD0 File Offset: 0x000E6CD0
		private void Awake()
		{
			Button component = base.GetComponent<Button>();
			if (component)
			{
				component.onClick.AddListener(new UnityAction(this.OnButtonClick));
			}
		}

		// Token: 0x060027FE RID: 10238 RVA: 0x000E8B08 File Offset: 0x000E6D08
		private void OnHandHoverBegin(Hand hand)
		{
			this.currentHand = hand;
			InputModule.instance.HoverBegin(base.gameObject);
			ControllerButtonHints.ShowButtonHint(hand, new EVRButtonId[]
			{
				EVRButtonId.k_EButton_Axis1
			});
		}

		// Token: 0x060027FF RID: 10239 RVA: 0x000E8B34 File Offset: 0x000E6D34
		private void OnHandHoverEnd(Hand hand)
		{
			InputModule.instance.HoverEnd(base.gameObject);
			ControllerButtonHints.HideButtonHint(hand, new EVRButtonId[]
			{
				EVRButtonId.k_EButton_Axis1
			});
			this.currentHand = null;
		}

		// Token: 0x06002800 RID: 10240 RVA: 0x000E8B60 File Offset: 0x000E6D60
		private void HandHoverUpdate(Hand hand)
		{
			if (hand.GetStandardInteractionButtonDown())
			{
				InputModule.instance.Submit(base.gameObject);
				ControllerButtonHints.HideButtonHint(hand, new EVRButtonId[]
				{
					EVRButtonId.k_EButton_Axis1
				});
			}
		}

		// Token: 0x06002801 RID: 10241 RVA: 0x000E8B90 File Offset: 0x000E6D90
		private void OnButtonClick()
		{
			this.onHandClick.Invoke(this.currentHand);
		}

		// Token: 0x04002804 RID: 10244
		public CustomEvents.UnityEventHand onHandClick;

		// Token: 0x04002805 RID: 10245
		private Hand currentHand;
	}
}
